var that
var rightAmt = wx.createAnimation({
  duration: 300,
  timingFunction: 'ease-out'
})
var offsethgt = wx.getSystemInfoSync().windowHeight

function init(target) {
  that = target
  that.setData({
    rightwin: false
  })
}

function show() {
  that.setData({
    righttop: -offsethgt,
    rightwin: true
  })
  rightAmt.top(0).step()
  that.setData({
    willClose: 1,
    rightAmt: rightAmt.export()
  })
}

function close() {
  rightAmt.top(-offsethgt).step()
  that.setData({
    willClose: 2,
    rightAmt: rightAmt.export()
  })
  setTimeout(() => {
    that.setData({
      willClose: 3,
      rightwin: false
    })
  }, 500)
}

module.exports = {
  init: init,
  close: close,
  show: show
}
